/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Wires.impl;

import EA_Model.IEC61970.Domain.CurrentFlow;
import EA_Model.IEC61970.Domain.Seconds;

import EA_Model.IEC61970.Wires.Breaker;
import EA_Model.IEC61970.Wires.WiresPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Breaker</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Wires.impl.BreakerImpl#getInTransitTime <em>In Transit Time</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Wires.impl.BreakerImpl#getRatedCurrent <em>Rated Current</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class BreakerImpl extends ProtectedSwitchImpl implements Breaker {
	/**
	 * The cached value of the '{@link #getInTransitTime() <em>In Transit Time</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getInTransitTime()
	 * @generated
	 * @ordered
	 */
	protected Seconds inTransitTime;

	/**
	 * The cached value of the '{@link #getRatedCurrent() <em>Rated Current</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRatedCurrent()
	 * @generated
	 * @ordered
	 */
	protected CurrentFlow ratedCurrent;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected BreakerImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return WiresPackage.Literals.BREAKER;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Seconds getInTransitTime() {
		if (inTransitTime != null && inTransitTime.eIsProxy()) {
			InternalEObject oldInTransitTime = (InternalEObject)inTransitTime;
			inTransitTime = (Seconds)eResolveProxy(oldInTransitTime);
			if (inTransitTime != oldInTransitTime) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, WiresPackage.BREAKER__IN_TRANSIT_TIME, oldInTransitTime, inTransitTime));
			}
		}
		return inTransitTime;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Seconds basicGetInTransitTime() {
		return inTransitTime;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setInTransitTime(Seconds newInTransitTime) {
		Seconds oldInTransitTime = inTransitTime;
		inTransitTime = newInTransitTime;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WiresPackage.BREAKER__IN_TRANSIT_TIME, oldInTransitTime, inTransitTime));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CurrentFlow getRatedCurrent() {
		if (ratedCurrent != null && ratedCurrent.eIsProxy()) {
			InternalEObject oldRatedCurrent = (InternalEObject)ratedCurrent;
			ratedCurrent = (CurrentFlow)eResolveProxy(oldRatedCurrent);
			if (ratedCurrent != oldRatedCurrent) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, WiresPackage.BREAKER__RATED_CURRENT, oldRatedCurrent, ratedCurrent));
			}
		}
		return ratedCurrent;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CurrentFlow basicGetRatedCurrent() {
		return ratedCurrent;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRatedCurrent(CurrentFlow newRatedCurrent) {
		CurrentFlow oldRatedCurrent = ratedCurrent;
		ratedCurrent = newRatedCurrent;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WiresPackage.BREAKER__RATED_CURRENT, oldRatedCurrent, ratedCurrent));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case WiresPackage.BREAKER__IN_TRANSIT_TIME:
				if (resolve) return getInTransitTime();
				return basicGetInTransitTime();
			case WiresPackage.BREAKER__RATED_CURRENT:
				if (resolve) return getRatedCurrent();
				return basicGetRatedCurrent();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case WiresPackage.BREAKER__IN_TRANSIT_TIME:
				setInTransitTime((Seconds)newValue);
				return;
			case WiresPackage.BREAKER__RATED_CURRENT:
				setRatedCurrent((CurrentFlow)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case WiresPackage.BREAKER__IN_TRANSIT_TIME:
				setInTransitTime((Seconds)null);
				return;
			case WiresPackage.BREAKER__RATED_CURRENT:
				setRatedCurrent((CurrentFlow)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case WiresPackage.BREAKER__IN_TRANSIT_TIME:
				return inTransitTime != null;
			case WiresPackage.BREAKER__RATED_CURRENT:
				return ratedCurrent != null;
		}
		return super.eIsSet(featureID);
	}

} //BreakerImpl
